import { request } from './axios';

/**
 * @description -封装User类型的接口方法
 */
export class UserService {
    /**
     * @description 用户登录
     * @param {string} username - 用户名
     * @return {HttpResponse} result
     */
    static async login1(params) {
        return request('/login', params, 'post');
    }
    static async login2(params) {
        return request('/login', params, 'post');
    }
    static async login3(params) {
        return request('/login', params, 'post');
    }
}

export class LandRelevant {
    /**
     * @description 获取地列表
     * @return {HttpResponse} result
     */
    static async landList(params) {
        return request('/land_list_info', params, 'get');
    }
}

export class PatientService {
    /**
     * @description 按照登录Id获取病人列表
     * @param {string} loginId - 登录ID
     */
    static async patientList(loginId) {
        return request(`patient-api/patient/get/byLoginId/${loginId}`, {}, 'get');
    }

    /**
     * @description 添加病人就诊卡信息
     * @param  params - 病人就诊卡信息
     */
    static async savePatientCard(params) {
        return request('patient-api/patient/save', params, 'post');
    }
}

export class PayService {
    /**
     * @description 支付
     */
    static async pay(params) {
        console.log(params)
        return request('/pay-api/pay/alipay', params, 'post');
    }

    static async getResult(params) {
        console.log(params)
        return request('/pay-api/pay/getResult', params, 'post');
    }
}

export class DepartService {
    /**
     * @description 按照父类科室ID获取子类科室
     * @param {string} parentId - 父类ID
     */
    static async AllParentList() {
        return request(`depart-api/depart/getAllParent/list`, {}, 'get');
    }
    static async childList(parentId) {
        return request(`depart-api/depart/getChild/${parentId}`, {}, 'get');
    }

    static async getDepartName(departId) {
        return request(`depart-api/depart/getDepartName/${departId}`, {}, 'get');
    }

    static async listHandle(){
        return request(`depart-api/depart/getAllChild/list`, {}, 'get');
    }
}

export class ArrangementService {
    /**
     * @description 按照日期获取排班信息
     * @param {String} departmentId - 科室id
     * @param {String} arrangementDt - 排班日期
     */
    static async findAllByDepartmentIdAndArrangementDt(departmentId,  arrangementDt) {
        return request(`arrangement-api/arrangement/get/findAllByDepartmentIdAndArrangementDt/${departmentId}/${arrangementDt}`, {}, 'get');
    }

    /**
     * @description 按照日期获取一周号源排班状态1
     * @param {String} departmentId - 科室id
     * @param {String} arrangementDt - 排班日期
     */
    static async stateByDt(departmentId,arrangementDt) {
        return request(`arrangement-api/arrangement/get/stateByDt/${departmentId}/${arrangementDt}`, {}, 'get');
    }

    static async saveArrangement(params){
        return request('/arrangement-api/arrangement/saveArrangement', params, 'post');
    }
}

export class AppointmentService {
    /**
     * @description 按照日期获取排班信息
     * @param {number} appointmentId - 预约单id
     * @param {String} arrangementDt - 排班日期
     */
    static async getPatientDetail(appointmentId) {
        return request(`appointment-api/appointment/getPatientDetail/${appointmentId}`, {}, 'get');
    }

    /**
     * @description 添加预约单信息
     * @param  params - 预约单信息
     */
    static async saveAppointment(params) {
        return request('appointment-api/appointment/submitAppointment', params, 'post');
    }

    /**
     * @description 病人查看预约单列表
     * @param  params - 查询条件
     */
    static async getAppointmentList(params) {
        return request('appointment-api/appointment/getAppointmentList/list', params, 'post');
    }

    /**
     * @description 签到
     * @param params - 签到号码和科室号信息
     */
    static async SignIn(params) {
        return request('appointment-api/appointment/getByPatientIdCardNumberOrAppointmentNumber', params, 'post');
    }

    static async cancelAppointment(appointmentId) {
        return request(`appointment-api/appointment/cancelAppointment/${appointmentId}`, {}, 'post');
    }
}

export class RegistrationPoolService {
    /**
     * @description 按照日期获取号源信息
     * @param {String} arrangementId - 排班id
     */
    static async findVoByArrangementId(arrangementId) {
        return request(`registrationPool-api/registrationPoolList/get/findVoByArrangementId/${arrangementId}`, {}, 'get');
    }

    static async getDoctorInfo(registrationPoolId) {
        return request(`registrationPool-api/registrationPoolList/getDoctorInfo/${registrationPoolId}`, {}, 'get');
    }
}

export class EmployeeService {
    /**
     * @description 按照登录Id获取病人列表
     * @param {string} departmentId - 登录ID
     */
    static async listAllByDepartmentId(departmentId) {
        return request(`employee-api/employee/get/listAllByDepartmentId/${departmentId}`, {}, 'get');
    }
}

export class ConsultationRoomService {
    /**
     * @description 按照登录Id获取病人列表
     * @param {string} departmentId - 登录ID
     */
    static async getListByDepartID(departmentId) {
        return request(`consultationRoom-api/consultationRoom/get/listByDepartID/${departmentId}`, {}, 'get');
    }
}

export class BusinessService {
    /**
     * @description 按照登录Id获取病人列表
     * @param {string} departmentId - 登录ID
     */
    static async findAllByDepartmentId(departmentId) {
        return request(`business-api/business/get/findAllByDepartmentId/${departmentId}`, {}, 'get');
    }
}